import numpy as np

a = np.arange(10, 50, 10)  # [10,20,30,40]
b = np.arange(4)  # [0,1,2,3]
print(a,b)

# 基本运算
print(a + b)  # [10 21 32 43]
print(a - b)  # [10 19 28 37]
print(a * b)  # [  0  20  60 120]
print(a ** b)  # [    1    20   900 64000]
print(10*np.sin(a))#[-5.44021111  9.12945251 -9.88031624  7.4511316 ]
print(b < 3)    # [ True  True  True False]


c = a.reshape(2,2)
d = b.reshape(2,2)
print(c)
print(d)
# 矩阵运算
# 矩阵乘法
print(c.dot(d))
print(np.dot(c,d))
# 行列式
print(c.trace())
print(np.trace(c))
# 求转置矩阵
print(c.T)

#矩阵求和
print(np.sum(c))
print(np.sum(c,axis=1))
# 求最大最小值
print(np.min(c))
print(np.max(c))